#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main()
{
	char ch1[11] = { 0 };
	scanf("%s", ch1);
	getchar();
	int n = strlen(ch1);
	int len1 = n;
	while (n--)
		ch1[n] = toupper(ch1[n]);
	char ch2[1000005] = { 0 };
	fgets(ch2, sizeof(ch2), stdin);
	n = strlen(ch2);
	int len = n - 1;
	ch2[n - 1] = 0;
	while (n--)
		ch2[n] = toupper(ch2[n]);
	int first = -1;
	char* pc = ch2;
	int count = 0;
	int cur = 0;
	while (pc - ch2 < len)
	{
		pc = strstr(ch2 + cur, ch1);
		if (!pc)break;
		int pls = 0;
		int len3 = 0;
		while (pc[pls] && pc[pls] != ' ')
		{
			len3++;
			pls++;
		}
		if (len3 == len1)
		{
			if (!(pc - ch2))
			{
				if (!count)
					first = pc - ch2;
				count++;
			}
			else if (*(pc - 1) == ' ')
			{
				if (!count)
					first = pc - ch2;
				count++;
			}
		}
		cur += len3 + pc - ch2 - cur;
	}
	if (first != -1)
		printf("%d %d\n", count, first);
	else
		printf("-1\n");
	return 0;
}